/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.hl7.v3.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.hl7.v3.BL1;
import org.hl7.v3.CS1;
import org.hl7.v3.II;
import org.hl7.v3.POCDMT000040ExternalAct;
import org.hl7.v3.POCDMT000040ExternalDocument;
import org.hl7.v3.POCDMT000040ExternalObservation;
import org.hl7.v3.POCDMT000040ExternalProcedure;
import org.hl7.v3.POCDMT000040InfrastructureRootTypeId;
import org.hl7.v3.POCDMT000040Reference;
import org.hl7.v3.V3Package;
import org.hl7.v3.XActRelationshipExternalReference;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>POCDMT000040 Reference</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getRealmCode <em>Realm Code</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getTypeId <em>Type Id</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getTemplateId <em>Template Id</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getSeperatableInd <em>Seperatable Ind</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getExternalAct <em>External Act</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getExternalObservation <em>External Observation</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getExternalProcedure <em>External Procedure</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getExternalDocument <em>External Document</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getNullFlavor <em>Null Flavor</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040ReferenceImpl#getTypeCode <em>Type Code</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class POCDMT000040ReferenceImpl extends EObjectImpl implements POCDMT000040Reference {
	/**
	 * The cached value of the '{@link #getRealmCode() <em>Realm Code</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRealmCode()
	 * @generated
	 * @ordered
	 */
	protected EList<CS1> realmCode;

	/**
	 * The cached value of the '{@link #getTypeId() <em>Type Id</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeId()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040InfrastructureRootTypeId typeId;

	/**
	 * The cached value of the '{@link #getTemplateId() <em>Template Id</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTemplateId()
	 * @generated
	 * @ordered
	 */
	protected EList<II> templateId;

	/**
	 * The cached value of the '{@link #getSeperatableInd() <em>Seperatable Ind</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSeperatableInd()
	 * @generated
	 * @ordered
	 */
	protected BL1 seperatableInd;

	/**
	 * The cached value of the '{@link #getExternalAct() <em>External Act</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExternalAct()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040ExternalAct externalAct;

	/**
	 * The cached value of the '{@link #getExternalObservation() <em>External Observation</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExternalObservation()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040ExternalObservation externalObservation;

	/**
	 * The cached value of the '{@link #getExternalProcedure() <em>External Procedure</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExternalProcedure()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040ExternalProcedure externalProcedure;

	/**
	 * The cached value of the '{@link #getExternalDocument() <em>External Document</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExternalDocument()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040ExternalDocument externalDocument;

	/**
	 * The default value of the '{@link #getNullFlavor() <em>Null Flavor</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNullFlavor()
	 * @generated
	 * @ordered
	 */
	protected static final Enumerator NULL_FLAVOR_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getNullFlavor() <em>Null Flavor</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNullFlavor()
	 * @generated
	 * @ordered
	 */
	protected Enumerator nullFlavor = NULL_FLAVOR_EDEFAULT;

	/**
	 * The default value of the '{@link #getTypeCode() <em>Type Code</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeCode()
	 * @generated
	 * @ordered
	 */
	protected static final XActRelationshipExternalReference TYPE_CODE_EDEFAULT = XActRelationshipExternalReference.XCRPT;

	/**
	 * The cached value of the '{@link #getTypeCode() <em>Type Code</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeCode()
	 * @generated
	 * @ordered
	 */
	protected XActRelationshipExternalReference typeCode = TYPE_CODE_EDEFAULT;

	/**
	 * This is true if the Type Code attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean typeCodeESet;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected POCDMT000040ReferenceImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return V3Package.eINSTANCE.getPOCDMT000040Reference();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<CS1> getRealmCode() {
		if (realmCode == null) {
			realmCode = new EObjectContainmentEList<CS1>(CS1.class, this, V3Package.POCDMT000040_REFERENCE__REALM_CODE);
		}
		return realmCode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040InfrastructureRootTypeId getTypeId() {
		return typeId;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetTypeId(POCDMT000040InfrastructureRootTypeId newTypeId, NotificationChain msgs) {
		POCDMT000040InfrastructureRootTypeId oldTypeId = typeId;
		typeId = newTypeId;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__TYPE_ID, oldTypeId, newTypeId);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTypeId(POCDMT000040InfrastructureRootTypeId newTypeId) {
		if (newTypeId != typeId) {
			NotificationChain msgs = null;
			if (typeId != null)
				msgs = ((InternalEObject)typeId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__TYPE_ID, null, msgs);
			if (newTypeId != null)
				msgs = ((InternalEObject)newTypeId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__TYPE_ID, null, msgs);
			msgs = basicSetTypeId(newTypeId, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__TYPE_ID, newTypeId, newTypeId));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<II> getTemplateId() {
		if (templateId == null) {
			templateId = new EObjectContainmentEList<II>(II.class, this, V3Package.POCDMT000040_REFERENCE__TEMPLATE_ID);
		}
		return templateId;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BL1 getSeperatableInd() {
		return seperatableInd;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetSeperatableInd(BL1 newSeperatableInd, NotificationChain msgs) {
		BL1 oldSeperatableInd = seperatableInd;
		seperatableInd = newSeperatableInd;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND, oldSeperatableInd, newSeperatableInd);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSeperatableInd(BL1 newSeperatableInd) {
		if (newSeperatableInd != seperatableInd) {
			NotificationChain msgs = null;
			if (seperatableInd != null)
				msgs = ((InternalEObject)seperatableInd).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND, null, msgs);
			if (newSeperatableInd != null)
				msgs = ((InternalEObject)newSeperatableInd).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND, null, msgs);
			msgs = basicSetSeperatableInd(newSeperatableInd, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND, newSeperatableInd, newSeperatableInd));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040ExternalAct getExternalAct() {
		return externalAct;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetExternalAct(POCDMT000040ExternalAct newExternalAct, NotificationChain msgs) {
		POCDMT000040ExternalAct oldExternalAct = externalAct;
		externalAct = newExternalAct;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT, oldExternalAct, newExternalAct);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setExternalAct(POCDMT000040ExternalAct newExternalAct) {
		if (newExternalAct != externalAct) {
			NotificationChain msgs = null;
			if (externalAct != null)
				msgs = ((InternalEObject)externalAct).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT, null, msgs);
			if (newExternalAct != null)
				msgs = ((InternalEObject)newExternalAct).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT, null, msgs);
			msgs = basicSetExternalAct(newExternalAct, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT, newExternalAct, newExternalAct));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040ExternalObservation getExternalObservation() {
		return externalObservation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetExternalObservation(POCDMT000040ExternalObservation newExternalObservation, NotificationChain msgs) {
		POCDMT000040ExternalObservation oldExternalObservation = externalObservation;
		externalObservation = newExternalObservation;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION, oldExternalObservation, newExternalObservation);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setExternalObservation(POCDMT000040ExternalObservation newExternalObservation) {
		if (newExternalObservation != externalObservation) {
			NotificationChain msgs = null;
			if (externalObservation != null)
				msgs = ((InternalEObject)externalObservation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION, null, msgs);
			if (newExternalObservation != null)
				msgs = ((InternalEObject)newExternalObservation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION, null, msgs);
			msgs = basicSetExternalObservation(newExternalObservation, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION, newExternalObservation, newExternalObservation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040ExternalProcedure getExternalProcedure() {
		return externalProcedure;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetExternalProcedure(POCDMT000040ExternalProcedure newExternalProcedure, NotificationChain msgs) {
		POCDMT000040ExternalProcedure oldExternalProcedure = externalProcedure;
		externalProcedure = newExternalProcedure;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE, oldExternalProcedure, newExternalProcedure);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setExternalProcedure(POCDMT000040ExternalProcedure newExternalProcedure) {
		if (newExternalProcedure != externalProcedure) {
			NotificationChain msgs = null;
			if (externalProcedure != null)
				msgs = ((InternalEObject)externalProcedure).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE, null, msgs);
			if (newExternalProcedure != null)
				msgs = ((InternalEObject)newExternalProcedure).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE, null, msgs);
			msgs = basicSetExternalProcedure(newExternalProcedure, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE, newExternalProcedure, newExternalProcedure));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040ExternalDocument getExternalDocument() {
		return externalDocument;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetExternalDocument(POCDMT000040ExternalDocument newExternalDocument, NotificationChain msgs) {
		POCDMT000040ExternalDocument oldExternalDocument = externalDocument;
		externalDocument = newExternalDocument;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT, oldExternalDocument, newExternalDocument);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setExternalDocument(POCDMT000040ExternalDocument newExternalDocument) {
		if (newExternalDocument != externalDocument) {
			NotificationChain msgs = null;
			if (externalDocument != null)
				msgs = ((InternalEObject)externalDocument).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT, null, msgs);
			if (newExternalDocument != null)
				msgs = ((InternalEObject)newExternalDocument).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT, null, msgs);
			msgs = basicSetExternalDocument(newExternalDocument, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT, newExternalDocument, newExternalDocument));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Enumerator getNullFlavor() {
		return nullFlavor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNullFlavor(Enumerator newNullFlavor) {
		Enumerator oldNullFlavor = nullFlavor;
		nullFlavor = newNullFlavor;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__NULL_FLAVOR, oldNullFlavor, nullFlavor));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public XActRelationshipExternalReference getTypeCode() {
		return typeCode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTypeCode(XActRelationshipExternalReference newTypeCode) {
		XActRelationshipExternalReference oldTypeCode = typeCode;
		typeCode = newTypeCode == null ? TYPE_CODE_EDEFAULT : newTypeCode;
		boolean oldTypeCodeESet = typeCodeESet;
		typeCodeESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_REFERENCE__TYPE_CODE, oldTypeCode, typeCode, !oldTypeCodeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetTypeCode() {
		XActRelationshipExternalReference oldTypeCode = typeCode;
		boolean oldTypeCodeESet = typeCodeESet;
		typeCode = TYPE_CODE_EDEFAULT;
		typeCodeESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, V3Package.POCDMT000040_REFERENCE__TYPE_CODE, oldTypeCode, TYPE_CODE_EDEFAULT, oldTypeCodeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetTypeCode() {
		return typeCodeESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case V3Package.POCDMT000040_REFERENCE__REALM_CODE:
				return ((InternalEList<?>)getRealmCode()).basicRemove(otherEnd, msgs);
			case V3Package.POCDMT000040_REFERENCE__TYPE_ID:
				return basicSetTypeId(null, msgs);
			case V3Package.POCDMT000040_REFERENCE__TEMPLATE_ID:
				return ((InternalEList<?>)getTemplateId()).basicRemove(otherEnd, msgs);
			case V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND:
				return basicSetSeperatableInd(null, msgs);
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT:
				return basicSetExternalAct(null, msgs);
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION:
				return basicSetExternalObservation(null, msgs);
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE:
				return basicSetExternalProcedure(null, msgs);
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT:
				return basicSetExternalDocument(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case V3Package.POCDMT000040_REFERENCE__REALM_CODE:
				return getRealmCode();
			case V3Package.POCDMT000040_REFERENCE__TYPE_ID:
				return getTypeId();
			case V3Package.POCDMT000040_REFERENCE__TEMPLATE_ID:
				return getTemplateId();
			case V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND:
				return getSeperatableInd();
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT:
				return getExternalAct();
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION:
				return getExternalObservation();
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE:
				return getExternalProcedure();
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT:
				return getExternalDocument();
			case V3Package.POCDMT000040_REFERENCE__NULL_FLAVOR:
				return getNullFlavor();
			case V3Package.POCDMT000040_REFERENCE__TYPE_CODE:
				return getTypeCode();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case V3Package.POCDMT000040_REFERENCE__REALM_CODE:
				getRealmCode().clear();
				getRealmCode().addAll((Collection<? extends CS1>)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__TYPE_ID:
				setTypeId((POCDMT000040InfrastructureRootTypeId)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__TEMPLATE_ID:
				getTemplateId().clear();
				getTemplateId().addAll((Collection<? extends II>)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND:
				setSeperatableInd((BL1)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT:
				setExternalAct((POCDMT000040ExternalAct)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION:
				setExternalObservation((POCDMT000040ExternalObservation)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE:
				setExternalProcedure((POCDMT000040ExternalProcedure)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT:
				setExternalDocument((POCDMT000040ExternalDocument)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__NULL_FLAVOR:
				setNullFlavor((Enumerator)newValue);
				return;
			case V3Package.POCDMT000040_REFERENCE__TYPE_CODE:
				setTypeCode((XActRelationshipExternalReference)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case V3Package.POCDMT000040_REFERENCE__REALM_CODE:
				getRealmCode().clear();
				return;
			case V3Package.POCDMT000040_REFERENCE__TYPE_ID:
				setTypeId((POCDMT000040InfrastructureRootTypeId)null);
				return;
			case V3Package.POCDMT000040_REFERENCE__TEMPLATE_ID:
				getTemplateId().clear();
				return;
			case V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND:
				setSeperatableInd((BL1)null);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT:
				setExternalAct((POCDMT000040ExternalAct)null);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION:
				setExternalObservation((POCDMT000040ExternalObservation)null);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE:
				setExternalProcedure((POCDMT000040ExternalProcedure)null);
				return;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT:
				setExternalDocument((POCDMT000040ExternalDocument)null);
				return;
			case V3Package.POCDMT000040_REFERENCE__NULL_FLAVOR:
				setNullFlavor(NULL_FLAVOR_EDEFAULT);
				return;
			case V3Package.POCDMT000040_REFERENCE__TYPE_CODE:
				unsetTypeCode();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case V3Package.POCDMT000040_REFERENCE__REALM_CODE:
				return realmCode != null && !realmCode.isEmpty();
			case V3Package.POCDMT000040_REFERENCE__TYPE_ID:
				return typeId != null;
			case V3Package.POCDMT000040_REFERENCE__TEMPLATE_ID:
				return templateId != null && !templateId.isEmpty();
			case V3Package.POCDMT000040_REFERENCE__SEPERATABLE_IND:
				return seperatableInd != null;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_ACT:
				return externalAct != null;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_OBSERVATION:
				return externalObservation != null;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_PROCEDURE:
				return externalProcedure != null;
			case V3Package.POCDMT000040_REFERENCE__EXTERNAL_DOCUMENT:
				return externalDocument != null;
			case V3Package.POCDMT000040_REFERENCE__NULL_FLAVOR:
				return NULL_FLAVOR_EDEFAULT == null ? nullFlavor != null : !NULL_FLAVOR_EDEFAULT.equals(nullFlavor);
			case V3Package.POCDMT000040_REFERENCE__TYPE_CODE:
				return isSetTypeCode();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (nullFlavor: ");
		result.append(nullFlavor);
		result.append(", typeCode: ");
		if (typeCodeESet) result.append(typeCode); else result.append("<unset>");
		result.append(')');
		return result.toString();
	}

} //POCDMT000040ReferenceImpl
